package com.wodsy.phoenix.datadao.settlec.dao.impl;

import com.wodsy.phoenix.datadao.base.BaseHibernateDao;
import com.wodsy.phoenix.datadao.settlec.dao.SettleReviewDao;
import com.wodsy.phoenix.dataobject.base.Pager;
import com.wodsy.phoenix.dataobject.settlec.model.SettleReview;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

/**
 * Created by Huang on 2015/4/22.
 */
@Repository("settleReviewDao")
public class SettleReviewDaoImpl extends BaseHibernateDao<SettleReview,Integer> implements SettleReviewDao {
    @Autowired
    @Qualifier(value="settlec")
    @Override
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    @Override
    public Class<SettleReview> getModelClass() {
        return SettleReview.class;
    }

    @Override
    public Pager<SettleReview> findSettleReviews(Pager<SettleReview> pager) {
        Criteria criteria = getSession().createCriteria(getModelClass());
        return toPager(pager, criteria);
    }
}
